package com.sky.mapper;

import com.sky.entity.Dish;
import com.sky.entity.SetmealDish;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 苏成博
 * @date 2023-02-08 15:05
 */
@Mapper
public interface SetmealDishMapper {
    @Select("select count(*) from setmeal_dish where dish_id=#{dishId}")
    Integer findByDishId(Integer dishId);

    /**
     * 新增套餐菜品
     * @param setmealDishs
     */
    void saveSetMealDish(List<SetmealDish> setmealDishs);

    //List<Dish> findBySetmealId(Integer setmealId);
    @Select("select * from setmeal_dish where setmeal_id=#{setmealId}")
    List<SetmealDish> findBySetmealId(Integer setmealId);

    @Delete("delete from setmeal_dish where setmeal_id = #{setmealId}")
    void deleteBySetmealId(Long setmealId);
}
